Back to Contents        Previous        Next








28. Icon validation strings

Each icon (and writable menu item) has a validation string. This can be a null string or it can contain some ‘commands’ which are separated by semicolons. These commands allow the programmer to define many properties of the icon, in addition to those set by the ‘icon flags’.

The validation string for an icon is normally set in a template editor when editing the icon, and for those with the RISC OS 3 Programmers Reference Manuals all the options can be found on page 3-102.

The validation string is an ‘indirected’ text string (see next section) whose memory location is set up as part of the icon definition. An icon cannot have a validation string unless the icon is made ‘indirected’. (For writable menu items Dr Wimp automatically creates the needed conditions.)

A common command is Rn, where n is a number from 0 to 7, which specifies the border type for the icon. For example, R6 is the default action type border and R7 is a writable icon type border. R0 is equivalent to not using the R-command.

If the icon can be ‘pressed in’ then the “slab in” colour can be set. If you create a default action button in !WinEd you will see that the validation string is R6,3. Try changing the 3 to 7 or 11.

In Section 2.14 we saw that another very common command is Pspritename, where spritename is the name of a sprite for the pointer when the pointer is over that icon.

If you have lots of writable icons in a window then you can make it so that the caret can be moved between them with the Up and Down arrow keys, Tab and Return. If you put Ktar in the validation string of all your writable icons then they can all be navigated in that way. t - Tab, a - Up/Down Arrow keys, r - Return. You can use any combination you like.

The caret will move in order of icon number so if you have writable icons numbered 3,11,7,8,2 then it will move in the order: 2,3,7,8,11 for the Down arrow, Tab or Return and 11,8,7,3,2 for the Up arrow. So make sure that if you are going to use this then your writable icons are numbered in such a way that the caret will move in a predictable manner.

If you want the Wimp to notify your application of all keypresses e.g. so that you can take some specific programming action in response to, say, the function keys, then you will need to use Kn in the validation string (and this would bring the special key codes table in Section 2.4 into use).

As mentioned, more than one validation string command can be used for each icon (or writable menu item) if they are separated by semicolons. So for a typical writable icon you may have: R7;Pptr_write;Ktar

(A more comprehensive explanation of all validation string commands is contained in “Dr Wimp’s Surgery” - the charity book mentioned at the start of this Manual.)









Top of page        Back to Contents        Previous        Next